var TABEL_NAME = 'emlog_user';
var model_fn = function (db, cb) {
    var lyby = require('../util');
    var m = db.define(TABEL_NAME, {
        userid : {type : 'text',size : 200 ,key : true},
        username : {type : 'text',size : 32 ,key : true},
        password : {type : 'text',size : 64},
        nickName : {type : 'text',size : 20},
        mobile : {type : 'text',size : 20},
        qqOpenid : {type : 'text',size : 32},
        regTime : {type : 'date',time : true},
        loginTime : {type : 'date',time : true},
        email : {type : 'text',size : 64},
        level : { type: "integer", unique: true },
        qqinfo : Object,
        vcginfo : Object/*,
    { openid: 'oKSlnt7Y50C9wuDpo82J9J7Ps6YI',
        nickname: '谦',
        sex: 1,
        language: 'zh_CN',
        city: '运城',
        province: '山西',
        country: '中国',
        headimgurl: 'http://wx.qlogo.cn/mmopen/oOYZG6jjhSSKPQ2AWvUv6ZkKPOKKwEY3DlcvGC3BhSYHNob27XZqlpdTlian7QPS7pezcPyYKicibJakxPP2sxdmQ/0',
        privilege: [],
        unionid: 'oB1O_vlcto-CDBe1l4vxPtNFz31U' }*/
    });
    //m.drop(function(){
        m.sync(function () {
        });
    //});
    model_fn.model = m;
    return cb();
};
model_fn.getAlluser = function(callBack){
    _DB.driver.execQuery("SELECT username FROM "+TABEL_NAME, function (err, data) {
        callBack.apply(this,arguments);
    })
};
model_fn.queryObj = function(){
    this.orm = require('orm');
};
model_fn.queryObj.prototype = {
    getAllUser:function(){
        //db.driver.execQuery("SELECT id, email FROM user", function (err, data) { ... })
    }
};
module.exports = model_fn;